<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  ~ Copyright (c) 2018. QDU 2015 Java1 Team CompilationError
  --%>

<%--
  Created by IntelliJ IDEA.
  User: inkux
  Date: 2018/5/22
  Time: 10:32
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<html>
<head>
	<title>Permission Group Manager</title>
	<%@include file="../resources/js_css_includes.jsp" %>
	<script src="${pageContext.request.contextPath}/js/permission_group_manager.js"></script>
</head>
<body>
<%@include file="../resources/navigation_header.jsp" %>
<%@include file="../resources/jsp_body_preludes.jsp" %>
<div id="frame_body">
	<div class="table_div_forall">
		<table id="permission_group_data_table" class="data_table" style="max-width: 1500px;">
		<thead>
		<tr>
			<%--<th></th>--%>
			<th>#</th>
			<th>Name</th>
			<th>Perm. Admin</th>
			<th>Modify User</th>
			<th>Lookup User</th>
			<th>Modify Dept.</th>
			<th>Lookup Dept.</th>
			<th>Modify Desg.</th>
			<th>Lookup Desg.</th>
			<th>Modify Delivery Men</th>
			<th>Lookup Delivery Men</th>
			<th>Modify Centers</th>
			<th>Lookup Centers</th>
			<th>Use Deliver System</th>
			<th>Operations</th>
		</tr>
		</thead>
		<tbody>
		<c:forEach var="group" items="${groups}">
			<tr>
					<%--<td><input id="check_group" class="check_group"--%>
					<%--name="${group.id}"--%>
					<%--type="checkbox" value="${group.id}"/></td>--%>
				<td>${group.id}</td>
				<td>${group.groupName}</td>
				<td>${group.admin}</td>
				<td>${group.modifyUser}</td>
				<td>${group.lookupUser}</td>
				<td>${group.modifyDepartment}</td>
				<td>${group.lookupDepartment}</td>
				<td>${group.modifyDesignation}</td>
				<td>${group.lookupDesignation}</td>
				<td>${group.modifyDeliverman}</td>
				<td>${group.lookupDeliverman}</td>
				<td>${group.modifyCenter}</td>
				<td>${group.lookupCenter}</td>
				<td>${group.useDeliverSystem}</td>
				<c:if test="${permissions.admin}">
					<td><a href="javascript:confirmDelete(${group.id});">Delete</a>
						<a target="_blank"
						   href="${pageContext.request.contextPath}/admin/modify_permission_group?groupId=${group.id}">Modify</a>
					</td>
				</c:if>
			</tr>
		</c:forEach>
		</tbody>
		</table>
		<script>
			var table;
			$().ready(function () {
				table = $("#permission_group_data_table").DataTable({
					select: true
				});
			})
		</script>
		<p><a class="btn_color2" href="new_permission_group">New Permission Group</a></p>
		<button class="btn_color1" onclick="confirmDeleteBatch()">Delete Selected</button>
		<p style="font-size: small;"><i>Hold Ctrl to select multiple</i></p>
	</div>
	<style>
		td, th {
			max-width: 30px;
			/*white-space: nowrap;*/
			text-overflow: ellipsis;
		}
	</style>
</div>
</body>
</html>
